from db.operationDb.ip_pool import getIpNumFromIpPopl
from db.operationDb.shopMeituanInfo import getIpFromShopMeituanInfo


def getMtShopIpInfo(account, shopType):
    """
    获取美团店铺的ip信息，包括ip及其数据库的ip编号
    :param account:
    :param shopType:
    :return:
    """
    ip = getIpFromShopMeituanInfo(account, shopType)
    if ip == -1:
        return -1
    if not ip:
        return -2
    ip_num = getIpNumFromIpPopl(ip)
    if ip_num == -1:
        return -1
    if not ip_num:
        return -2

    return {"ip_num": ip_num, "ip": ip}
